package org.example;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

public class LeftPanel extends JPanel {
    private JButton left;


    public LeftPanel(PhotoFrame photoFrame) {
        this.addContent(photoFrame);
    }

    private void addContent(PhotoFrame photoFrame) {
        this.left = new JButton();
        this.left.setLayout(null);
        this.left.setText("上一张");
        this.left.setBounds(0, 0, 50, 50);
        this.left.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                MainP mainP = photoFrame.getMainP();
                CardLayout cardLayout = (CardLayout) mainP.getLayout();
                cardLayout.previous(mainP);
            }
        });
        this.add(this.left);
    }
}
